package com.rub.android.utils

import org.jsoup.Jsoup

class JsoupUtil {

    fun test() {
        val get = Jsoup.connect("https://sample-videos.com/index.php#sample-mp4-video").timeout(10 * 1000).get()

        var bodyEle = get.body().getElementById("sample-mp4-video").select("tbody").first()

        val baseUrl = "https://sample-videos.com/"

        var dataList = ArrayList<Video>()
        var id =0
        bodyEle.select("tr").forEach {
            var tdEle = it.select("td")
            if (tdEle.size > 3) {
                id++
                val videoUrl = baseUrl + tdEle[3].select("a").attr("href")
                dataList.add(Video(id,"海洋的动漫",videoUrl,""))
            }
        }
    }
    // Get average runtime of successful runs in seconds

}
data class Video(val id:Int,val videoName:String,val videoUrl:String,val videoImg: String)

fun main() {
    JsoupUtil().test()
}
